package xcmg.device.dao.mapper;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.purchase.BuyPlanDO;
import xcmg.device.service.vo.purchase.BuyPlanReportVO;
import xcmg.device.service.vo.purchase.BuyPlanVO;

import java.util.List;

@Mapper
public interface BuyPlanMapper {

    List<BuyPlanDO> list(BuyPlanVO condition);

    List<BuyPlanDO> findByIds(@Param("ids") List<String> ids);

    int listCount(BuyPlanVO condition);

    int deleteByPrimaryKey(String id);

    int insert(BuyPlanDO record);

    BuyPlanDO selectByPrimaryKey(String id);

    int update(BuyPlanDO record);

    BuyPlanDO findByPlanOrder(@Param("planOrder")String planOrder, @Param("orgId")String orgId);

    int updateDel(@Param("ids") List<String> ids, @Param("del") Integer del);

    int findForDeleteByIds(@Param("ids") List<String> ids);

    int updateSendStatus(@Param("planOrder")String planOrder, @Param("sendStatus")Integer sendStatus, @Param("orgId")String orgId);

    List<BuyPlanReportVO> listForAdd(BuyPlanReportVO condition);

    BuyPlanReportVO findReplaceMaterial(@Param("materialsNo")String materialsNo, @Param("orgId")String orgId);

    /**
     * 统计零件在某月采购计划中出现的次数
     *
     * @param materialsNo
     * @param orgId
     * @return
     */
    Integer countMaterialsPlan(@Param("materialsNo")String materialsNo, @Param("orgId")String orgId, @Param("yearMonth") String yearMonth);

    List<BuyPlanReportVO> planReportList(BuyPlanReportVO condition);
}